The present invention relates to a data processing apparatus having a subroutine processing function, and particularly to a subroutine link control system which is capable of shifting into a subroutine and returning therefrom at high speeds, and an apparatus therefor.
The subroutine processing function refers to the processing in which, when shifting into a subroutine, the contents of a group of general registers used for the arithmetic operation are saved in a main memory unit or by an exclusively designed memory and, when returning from the subroutine, the saved data is returned from the main memory unit or the exclusively designed memory into a group of general registers.
In the field of control computers in recent years, it has been a trend to increase the operation speed of the arithmetic circuit, to increase the number of general registers, to increase the capacity of main memory unit, and to standardize the program. A cache memory which is a high-speed memory having a small capacity has been employed accompanying the trend toward increasing the capacity of the main memory unit. With this memory, however, the writing operation is slower than the reading operation, and the number of subroutines is on the increase due to standardization of program.
Therefore, although the arithmetic circuit operates at high speeds, extended periods of time are required for saving the contents of general registers and for resuming the contents required by the subroutine processing, making it difficult to perform the processing at high speeds as a whole.
For instance, if the load which occupies about 10% of the subroutine processing increases to about 50%, the speed of processing is not increased as a whole even if the operation speed of the arithmetic circuit is doubled.
In a system in which the contents of a group of general registers are saved by an embedded exclusive memory when shifting into the subroutine, the operation speed can be increased as compared with the system in which the contents are saved by the main memory unit. However, since the contents of a group of general registers are saved for every register, extended periods of time are required for the saving when there exist a large number of registers that have to be saved.
If the general registers are divided into a plurality of groups and are used with each group as a unit when shifting into a subroutine or returning therefrom, the saving and resuming of subroutine can be performed within very short periods of time.
In shifting into a subroutine or returning therefrom, however, the following matters will have to be taken into consideration.
(1) Since the subroutine is nested in a plurality of stages, a countermeasure must be taken with regard to overflow of the nest. PA1 (2) Not only must the data be saved and resumed, the data must further be handed over. PA1 (3) A function is necessary to designate which one should be saved (without destroying it) among the groups of general registers.
A subroutine link control system which operates at high speeds has not, yet been proposed, to satisfy the above-mentioned requirements.